Locatives

Locatives in T are similar to the pointers or references of languages like C or Algol 68.

Locatives are obtained by evaluating LOCATIVE-expressions. The value in the location they refer to may be fetched using the CONTENTS operation, and stored using SET.

Objects which act as locatives may be created using OBJECT, as long as they handle the CONTENTS and (SETTER CONTENTS) operations appropriately, and handle LOCATIVE? by returning true.

Special form


\begin{inset}{}
\par
Returns a locative which accesses the location specified by...
...SET (TEMP1 TEMP2) VALUE)) \\
((LOCATIVE? SELF) T)))
\end{tabbing}}
\end{inset}

Settable operation


\begin{inset}{}
\par
Dereferences (indirects through) the {\it locative\/}.
\beg...
...v$& (SET {\it location\/} {\it value\/})
\end{tabular} \end{codexenv}\end{inset}

Type predicate operation


\begin{inset}{}
Returns true if {\it object\/} is a locative.
\end{inset}